package org.wzys.Mapper;

import org.apache.ibatis.annotations.*;
import org.wzys.Pojo.Caritem;
import org.wzys.Pojo.Product;
import org.wzys.Pojo.ProductQueryparm;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface CarItemMapper {

    void add(Product product);



@Update("update cart_items set quantity=#{quantity} ,update_time=#{utime} where product_id=#{productId}")
    void updateOrder(Integer quantity, Integer productId, LocalDateTime utime);

    List<Caritem> list(ProductQueryparm parm);

    @Delete("delete from cart_items where product_id=#{productId}")
    void deleteCaritm(Integer productId);

    //通过产品ID来查找购物车对应商品数量
    @Select("select quantity from cart_items where product_id=#{productId}")
    Integer getQuantityByProductId(Integer productId);

    //增加物品到购物车

}
